/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.login.plugin.a;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.qihoo.gamecenter.sdk.common.i.k;
import com.qihoo.gamecenter.sdk.common.i.s;
import com.qihoo.gamecenter.sdk.login.plugin.d;
import com.qihoo.gamecenter.sdk.login.plugin.d.a;
import com.qihoo.gamecenter.sdk.login.plugin.h.e;
import com.qihoo.gamecenter.sdk.login.plugin.h.f;
import com.qihoo.gamecenter.sdk.login.plugin.login.c;
import java.util.HashMap;
import java.util.Locale;

public class h {
    public static String a(Context paramContext, c paramc, Intent paramIntent) {
        String str = null;
        int i = paramc.j();
        e.a("LoginUtils", new Object[] { "loigin method" + i });
        switch (i) {
        case 2:
            str = b(paramContext, paramc, paramIntent);
            break;
        case 3:
            str = d(paramContext, paramc, paramIntent);
        }
        if (TextUtils.isEmpty(str))
            e.a("LoginUtils", new Object[] { "login url is empty!" });
        else
            e.a("LoginUtils", new Object[] { "login url: ", str });
        return str;
    }

    public static String b(Context paramContext, c paramc, Intent paramIntent) {
        return a(paramContext, paramc, com.qihoo.gamecenter.sdk.login.plugin.h.a.a(paramIntent));
    }

    public static String a(Context paramContext, c paramc, String paramString) {
        if ((paramc == null) || (TextUtils.isEmpty(paramc.c())))
            return null;
        HashMap localHashMap = new HashMap();
        localHashMap.put("method", "UserIntf.login");
        localHashMap.put("username", paramc.b());
        localHashMap.put("password", paramc.c());
        localHashMap.put("des", "0");
        if (paramc.e())
            localHashMap.put("is_keep_alive", "1");
        if ((!(TextUtils.isEmpty(paramc.g()))) && (!(TextUtils.isEmpty(paramc.f())))) {
            localHashMap.put("sc", paramc.g());
            localHashMap.put("uc", paramc.f());
        }
        e.a("LoginUtils", new Object[] { "getCookieUrl params = ", localHashMap });
        String str = com.qihoo.gamecenter.sdk.common.e.a.a(localHashMap, s.q(paramContext));
        e.a("LoginUtils", new Object[] { "getCookieUrl url = ", str });
        return str;
    }

    public static String c(Context paramContext, c paramc, Intent paramIntent) {
        String str1 = com.qihoo.gamecenter.sdk.login.plugin.h.a.a(paramContext, paramIntent);
        String str2 = com.qihoo.gamecenter.sdk.login.plugin.h.a.b(paramContext, paramIntent);
        String str3 = com.qihoo.gamecenter.sdk.login.plugin.h.a.c(paramContext, paramIntent);
        String str4 = "token";
        String str5 = "https://openapi.360.cn/oauth2/authorize.json?client_id=";
        String str6 = "basic";
        StringBuilder localStringBuilder = new StringBuilder(str5 + str1);
        localStringBuilder.append("&response_type=").append(str4);
        localStringBuilder.append("&redirect_uri=oob");
        localStringBuilder.append("&state=test_state111");
        localStringBuilder.append("&scope=").append(str6);
        localStringBuilder.append("&version=" + "Qhopensdk-".concat(f.e()));
        localStringBuilder.append("&mid=" + k.a(str3));
        localStringBuilder.append("&DChannel=" + str2);
        localStringBuilder.append("&display=mobile.cli_v1");
        localStringBuilder.append("&oauth2_login_type=" + c.a());
        String str7 = localStringBuilder.toString();
        e.a("LoginUtils", new Object[] { "auth url: ", str7 });
        return str7;
    }

    public static String a(Context paramContext, String paramString1, boolean paramBoolean, String paramString2) {
        if (null == paramString1)
            return null;
        HashMap localHashMap = new HashMap();
        localHashMap.put("method", "CommonAccount.sendSmsCode");
        localHashMap.put("account", paramString1);
        localHashMap.put("condition", (paramBoolean) ? "1" : "2");
        localHashMap.put("des", "0");
        e.a("LoginUtils", new Object[] { "getSendSmsCodeUrl params = " + localHashMap });
        String str = com.qihoo.gamecenter.sdk.common.e.a.a(localHashMap, s.q(paramContext));
        e.a("LoginUtils", new Object[] { "getSendSmsCodeUrl url = ", str });
        return str;
    }

    public static String d(Context paramContext, c paramc, Intent paramIntent) {
        String str1 = com.qihoo.gamecenter.sdk.login.plugin.h.a.a(paramIntent);
        if ((paramc == null) || (TextUtils.isEmpty(paramc.h())))
            return null;
        HashMap localHashMap = new HashMap();
        localHashMap.put("method", "CommonAccount.mobileLoginByToken");
        localHashMap.put("account", paramc.b());
        localHashMap.put("token", paramc.h());
        localHashMap.put("des", "0");
        e.a("LoginUtils", new Object[] { "getLoginByTockenUrl params = " + localHashMap });
        String str2 = com.qihoo.gamecenter.sdk.common.e.a.a(localHashMap, s.q(paramContext));
        e.a("LoginUtils", new Object[] { "getLoginByTockenUrl url = ", str2 });
        return str2;
    }

    public static String a(Context paramContext, String paramString1, String paramString2, String paramString3,
            String paramString4) {
        String str1 = paramString4;
        HashMap localHashMap = new HashMap();
        localHashMap.put("method", "CommonAccount.mobileResetPassByToken");
        localHashMap.put("account", paramString1);
        localHashMap.put("token", paramString2);
        localHashMap.put("password", paramString3);
        localHashMap.put("des", "0");
        e.a("LoginUtils", new Object[] { "getResetPwdByTokenUrl params = " + localHashMap });
        String str2 = com.qihoo.gamecenter.sdk.common.e.a.a(localHashMap, s.q(paramContext));
        e.a("LoginUtils", new Object[] { "getResetPwdByTokenUrl url = ", str2 });
        return str2;
    }

    public static String b(Context paramContext, String paramString1, String paramString2, String paramString3,
            String paramString4) {
        String str1 = paramString4;
        HashMap localHashMap = new HashMap();
        localHashMap.put("method", "CommonAccount.findAccountPwd");
        localHashMap.put("account", paramString1);
        localHashMap.put("type", "2");
        localHashMap.put("smscode", paramString2);
        localHashMap.put("newpwd", paramString3);
        localHashMap.put("des", "0");
        e.a("LoginUtils", new Object[] { "getSetNewPwdBySmsCode params = " + localHashMap });
        String str2 = com.qihoo.gamecenter.sdk.common.e.a.a(localHashMap, s.q(paramContext));
        e.a("LoginUtils", new Object[] { "getSetNewPwdBySmsCode url = " + str2 });
        return str2;
    }

    public static String a(Context paramContext, String paramString) {
        HashMap localHashMap = new HashMap();
        localHashMap.put("method", "CommonAccount.getUserInfo");
        localHashMap.put("des", "0");
        e.a("LoginUtils", new Object[] { "getAutoLoginByQTUrl params = " + localHashMap });
        String str = com.qihoo.gamecenter.sdk.common.e.a.a(localHashMap, s.q(paramContext));
        e.a("LoginUtils", new Object[] { "getAutoLoginByQTUrl url = " + str });
        return str;
    }

    public static boolean b(Context paramContext, String paramString) {
        return (paramString.toUpperCase(Locale.getDefault()).startsWith("360U"));
    }

    public static String a(String paramString1, String paramString2, String paramString3, boolean paramBoolean,
            String paramString4, String paramString5, int paramInt) {
        e.a("LoginUtils", new Object[] { "username=" + paramString1 });
        e.a("LoginUtils", new Object[] { "fields=" + paramString3 });
        e.a("LoginUtils", new Object[] { "ignoreCaptcha=" + paramBoolean });
        e.a("LoginUtils", new Object[] { "sc=" + paramString4 });
        e.a("LoginUtils", new Object[] { "uc=" + paramString5 });
        e.a("LoginUtils", new Object[] { "appId=" + paramInt });
        HashMap localHashMap = new HashMap();
        localHashMap.put("method", "UserIntf.login");
        localHashMap.put("des", "0");
        if (paramBoolean) {
            localHashMap.put("ignore_captcha", "1");
        }
        else {
            localHashMap.put("ignore_captcha", "0");
            if ((!(TextUtils.isEmpty(paramString4))) && (!(TextUtils.isEmpty(paramString5)))) {
                localHashMap.put("sc", paramString4);
                localHashMap.put("uc", paramString5);
            }
        }
        localHashMap.put("is_keep_alive", "1");
        localHashMap.put("username", paramString1);
        localHashMap.put("password", paramString2);
        if (!(TextUtils.isEmpty(paramString3)))
            localHashMap.put("fields", paramString3);
        return com.qihoo.gamecenter.sdk.common.e.a.a(localHashMap, paramInt);
    }

    public static String a(int paramInt, String paramString) {
        e.a("LoginUtils", new Object[] { "getLoginErrMsg Entry err = ", Integer.valueOf(paramInt), " org msg = ",
                paramString });
        if (paramInt == 5006)
            return d.a(d.a.f);
        if (paramInt == 5007)
            return d.a(d.a.g);
        if (paramInt == 5008)
            return d.a(d.a.e);
        if (paramInt == 5009)
            return d.a(d.a.g);
        if (paramInt == 5010)
            return d.a(d.a.r);
        if (paramInt == 5011)
            return d.a(d.a.t);
        if (paramInt == 5012)
            return d.a(d.a.i);
        if (paramInt == 5025)
            return d.a(d.a.h);
        if (paramInt == 5099)
            return d.a(d.a.i);
        if (paramInt == 99101)
            return d.a(d.a.i);
        if (paramInt == 99102)
            return d.a(d.a.i);
        if (paramInt == 4010206)
            return d.a(d.a.g);
        if (paramInt == 4010207)
            return d.a(d.a.d);
        if (paramInt == 1020400) {
            if (!(TextUtils.isEmpty(paramString)))
                return paramString;
            return d.a(d.a.cD);
        }
        if (paramInt == -1)
            return d.a(d.a.i);
        if (paramInt == 221)
            return d.a(d.a.cl);
        if (paramInt == 222)
            return d.a(d.a.cm);
        if (paramInt == 1030)
            return d.a(d.a.cn);
        if (paramInt == 1034)
            return d.a(d.a.co);
        if ((paramInt == 105000) || (paramInt == 105001))
            return d.a(d.a.cp);
        if (!(TextUtils.isEmpty(paramString)))
            return paramString;
        return d.a(d.a.g);
    }

    public static String a(String paramString) {
        if (TextUtils.isEmpty(paramString))
            return d.a(d.a.dH);
        if (paramString.length() < 2)
            return d.a(d.a.dI);
        if (TextUtils.isDigitsOnly(paramString))
            return d.a(d.a.dL);
        if (paramString.toUpperCase(Locale.getDefault()).startsWith("360U"))
            return d.a(d.a.dK);
        if (paramString.length() > 14)
            return d.a(d.a.dJ);
        return null;
    }
}